package factory.simplefactory;

public class OrderPizza {
    private SimpleFactory factory;

    public OrderPizza(SimpleFactory factory) {
        this.factory = factory;
    }

    public void order(String type) {
        Pizza pizza = factory.createPizza(type);
        if (pizza != null) {
            pizza.prepare();
            pizza.bake();
            pizza.cut();
            pizza.box();
            System.out.println("----------");
        } else {
            System.out.println("无法订购" + type + "披萨");
        }
    }
}
